# Using RStudio as parent image
FROM rocker/rstudio:latest

LABEL org.opencontainers.image.licenses="GPL-2.0-or-later" \
      org.opencontainers.image.source="https://github.com/rocker-org/rocker-versioned2" \
      org.opencontainers.image.vendor="Rocker Project" \
      org.opencontainers.image.authors="Carl Boettiger <cboettig@ropensci.org>"


ENV DEFAULT_USER=rstudio
ENV PANDOC_VERSION=default
ENV QUARTO_VERSION=default

# Copy the current directory contents into the container at /app
COPY . /home/rstudio

# Setting the working directory to /app
WORKDIR /home/rstudio

RUN chown -R rstudio /home/rstudio

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    libcurl4-openssl-dev libxml2 libmagick++-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev\
    && rm -rf /var/lib/apt/lists/* \
    && R -q -e 'install.packages(c("tidyverse","cowplot","ggpubr","randomForestSRC","rpart","rpart.plot","broom","xtable","cregg","grf","cjbart","remotes"))'

RUN R -q -e 'remotes::install_github("coolbutuseless/devout")'
RUN R -q -e 'remotes::install_github("coolbutuseless/devoutrgl")'
RUN R -q -e 'remotes::install_github("coolbutuseless/triangular")'
RUN R -q -e 'remotes::install_github("coolbutuseless/snowcrash")'
RUN R -q -e 'remotes::install_github("coolbutuseless/cryogenic")'
RUN R -q -e 'remotes::install_github("coolbutuseless/ggrgl", ref="main")'

EXPOSE 8787

CMD ["/init"]
